<?php

namespace App\Http\Controllers\Admin;

use App\Models\rebate;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class RebateController extends Controller
{
    public $timestamps = false;
    public function index()
    {
        $list = rebate::getRateList();
        return view('admin.rebate.index',['list'=>$list,'baseUrl'=>$this->baseUrl]);
    }

    public function edit($key,$rate)
    {
        $flag = rebate::modifyRate($key,$rate);

        if($flag){
            rebate::getRateList();
            return redirect('admin/rebate/index')->with('success','更新成功');
        }else{
            return redirect('admin/rebate/index')->with('danger','更新失败');
        }
    }
}
